<%-- 
    Document   : applicationcontent
    Created on : 05 4, 11, 5:14:24 PM
    Author     : Lee
--%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<s:div style="overflow: scroll; height: 470px">

    <s:div id="loanapplication">
        <!--    cssStyle="float: right; left: -5px; position: relative"-->
        <s:form theme="simple" action="add-loanverification" id="loanapplicationform" cssStyle="clear: both">
            <fieldset>
                <legend><h3>Loan Application Details</h3></legend>
                <s:div id="document">

                    <table cellspacing="0" border="0" width="100%">
                        <tr>
                            <td><s:label>Document:</s:label></td>
                            <td><div class="inputContainer"><s:textfield id="documenttype" cssStyle="font-size: 11px; width: 100px" name="documenttype" label="Document Type" value="Loan Application" readonly="true"/></div></td>
                            <td><s:label>Application No.:</s:label></td>
                            <td><div class="inputContainer"><s:textfield name="documentno" cssStyle="font-size: 11px; width: 100px" id="documentno" label="Document No."/></div></td>
                            <td><s:label>Application Date:</s:label></td>
                            <td><div class="inputContainer"><sj:datepicker name="documentdate" cssStyle="font-size: 11px; width: 100px" id="documentdate" label="Document Date" cssClass="validate[required] text-input" /></div></td>
                            <td><s:label>Loan Type</s:label></td>
                                <td>
                                <s:if test="%{#request['renew'] == 'yes'}">
                                    <div class="inputContainer">
                                        <s:select
                                            id="loantype"
                                            key="loantype"
                                            cssClass="validate[required]"
                                            name="loantype"
                                            list="{'New','Renew'}"
                                            headerKey="-1"
                                            headerValue=""
                                            emptyOption="false"
                                            value="Renew"
                                            cssStyle="font-size: 11px"
                                            />
                                    </div>
                                </s:if>
                                <s:else>
                                    <div class="inputContainer">
                                        <s:select
                                            id="loantype"
                                            key="loantype"
                                            cssStyle="font-size: 11px"
                                            cssClass="validate[required]"
                                            name="loantype"
                                            list="{'New','Renew'}"
                                            headerKey="-1"
                                            headerValue=""
                                            emptyOption="false"
                                            value="New" />
                                    </s:else>
                            </td>
                        </tr>
                    </table>
                    <table cellspacing="0" border="0" width="100%">
                        <tr>
                            <td style="visibility: hidden">HAHAHAH</td>
                        </tr>
                    </table>
                    <table cellspacing="0" border="0" width="100%">
                        <tr>
                            <td><s:label>Borrower ID No.:</s:label></td>
                            <td><s:textfield cssStyle="font-size: 11px; width: 100px;" label="Borrower Code" key="borrower.borrowerid" readonly="true" name="borid" id="borid" value="%{#request['borrowerinfo'].borrowercode}"/></td>
                        </tr>
                        <tr>
                            <td><s:label>Borrower Name:</s:label></td>
                                <td>
                                <s:if test="%{#request['borrowerinfo'] != null}">

                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="First Name" key="bor.firstname" value="%{#request['borrowerinfo'].firstname}" name="firstname" id="firstname" cssClass="validate[required] text-input" /></div>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="Middle Name" key="bor.middlename" value="%{#request['borrowerinfo'].middlename}" name="middlename" id="middlename" title="Please enter your username (at least 3 characters)" cssClass="validate[required] text-input" /></div>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="Last Name" key="bor.lastname" value="%{#request['borrowerinfo'].lastname}" name="lastname" id="lastname" title="Please enter your username (at least 3 characters)" cssClass="validate[required] text-input" /></div>
                                </s:if>
                                <s:else>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="First Name" key="bor.firstname" value="First Name" name="firstname" id="firstname" cssClass="validate[required] text-input" /></div>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="Middle Name" key="bor.middlename" value="Middle Name" name="middlename" id="middlename" title="Please enter your username (at least 3 characters)" cssClass="validate[required] text-input" /></div>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="Last Name" key="bor.lastname" value="Last Name" name="lastname" id="lastname" title="Please enter your username (at least 3 characters)" cssClass="validate[required] text-input" /></div>

                                </s:else>
                                <label id="notif" style="visibility: hidden; color: red; font-weight: bold">Borrower does not exist in the database.</label>
                            </td>
                        </tr>
                    </table>
                    <table cellspacing="0" border="0" width="100%">
                        <tr>
                            <td><s:label>Current Address</s:label></td>
                            <s:if test="%{#request['borrowerinfo'] != null}">
                                <td>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 170px" label="Street Address" value="%{#request['borrowerinfo'].streetaddress}"  key="bor.streetaddress" name="streetaddress" id="streetaddress" cssClass="validate[required]" /></div>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 170px" label="Barangay" value="%{#request['borrowerinfo'].barangay}"  key="bor.barangay" name="barangay" id="barangay" cssClass="validate[required]"/></div>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 170px" label="City or Municipality" value="%{#request['borrowerinfo'].cityormunicipality}"  key="bor.cityormunicipality" id="cityormunicipality" name="cityormunicipality" cssClass="validate[required]"/></div>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 170px" label="Province" value="%{#request['borrowerinfo'].province}"  key="bor.province" id="province" name="province" cssClass="validate[required]"/></div>
                                </td>
                            </s:if>
                            <s:else>
                                <td>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 170px" label="Street Address" value="Street Address"  key="bor.streetaddress" name="streetaddress" id="streetaddress" cssClass="validate[required]" /></div>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 170px" label="Barangay" value="Barangay"  key="bor.barangay" name="barangay" id="barangay" cssClass="validate[required]"/></div>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 170px" label="City or Municipality" value="City or Municipality"  key="bor.cityormunicipality" id="cityormunicipality" name="cityormunicipality" cssClass="validate[required]"/></div>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 170px" label="Province" value="Province"  key="bor.province" id="province" name="province" cssClass="validate[required]"/></div>
                                </td> 
                            </s:else>
                        </tr>
                        <tr>
                            <td><s:label>Area Code</s:label></td>
                                <td>
                                    <div class="inputContainer">
                                    <%--<% System.out.println("NASA IF");%>--%>
                                    <s:if test="%{#request['borrowerinfo'] != null}">
                                        <s:select
                                            cssStyle="font-size: 11px"
                                            label="Area Code:"
                                            name="selectedArea"
                                            id="selectedArea"
                                            list="%{#a.areas}"
                                            listKey ="areacode"
                                            listValue="areacode"
                                            headerKey="-1"
                                            headerValue=""
                                            emptyOption="false"
                                            cssClass="validate[required]"
                                            value="%{#request['borrowerinfo'].areacode}"
                                            />
                                    </s:if>
                                    <s:else>
                                        <s:select
                                            cssClass="validate[required]"
                                            cssStyle="font-size: 11px; width: 100px"
                                            label="Area Code:"
                                            name="selectedArea"
                                            id="selectedArea"
                                            list="%{#a.areas}"
                                            listKey ="areacode"
                                            listValue="areacode"
                                            headerKey="-1"
                                            headerValue=""
                                            emptyOption="false"
                                            />
                                    </s:else>
                                </div>
                            </td> 
                        </tr>
                        <tr style="display: none">
                            <td><s:label>Branch Code</s:label></td>
                            <td><s:textfield label="Branch Code:" name="selectedBranch" id="selectedBranch" value="%{#session['branch'].branchcode}" readonly="true"  /></td>
                            <td><s:label>Employee Id</s:label></td>
                            <td><s:textfield name="employees" id="employees" label="Employee Id" value="%{#session['employee'].idnumber}" readonly="true" key="loanapplications.employees" /><%-- --%></td>
                        </tr>
                        <tr>
                            <td><s:label>Loan Classification</s:label></td>
                            <td><div class="inputContainer"><s:select
                                        id="loanclassification"
                                        key="loanclassification"
                                        cssClass="validate[required]"
                                        cssStyle="font-size: 11px; width: 100px"
                                        name="loanclassification"
                                        list="%{#p.products}"
                                        listKey ="productname"
                                        listValue="productname"
                                        headerKey="-1"
                                        headerValue=""
                                        emptyOption="false"
                                        /></td>
                        </tr>
                        <tr>
                            <td>
                                <s:label>Loan Term<strong></strong></s:label>
                                </td>
                                <td>
                                    <div class="inputContainer">
                                    <s:select
                                        id="loanterm"
                                        key="loanclass"
                                        cssClass="validate[required]"
                                        cssStyle="font-size: 11px; width: 100px"
                                        label="Loan Classification"
                                        name="loanterm"
                                        list="{'30','60','90','100'}"
                                        headerKey="-1"
                                        headerValue=""
                                        emptyOption="false"
                                        value="%{#request['loanver'].loantype}" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <s:label>Amount Applied<strong></strong></s:label>
                                </td>
                                <td>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 100px" id="amountapplied" name="amountapplied" key="loanapplications.amountrequested" cssClass="validate[required] text-input"/><%-- --%>
                            </td>
                        </tr>
                    </table>
                </s:div>
                <s:div id="loan">
                    <table border="0" width="100%">

                    </table>
                </s:div>
            </fieldset>
            <hr />
            <s:div id="prev" cssStyle="font-size: 12px;">
                <fieldset style="width: 25%; float: left; height: 356px" >
                    <legend><h3>Previous Loan</h3></legend>
                    <%--<jsp:include page="admin/loan.jsp" />--%>
                    <table>
                        <tr style="display: none">
                            <td><s:label>Loan ID<strong></strong></s:label></td>
                            <td><s:textfield id="prevloanid" readonly="true" cssStyle="font-size: 11px; width: 100px" name="previousloanid" value="%{#request['latestloan'].loanid}" /></td>
                        </tr>
                        <tr>
                            <td><s:label>Account No.<strong></strong></s:label></td>
                            <td><s:textfield name="prevacctno" id="prevacctno" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].account}" /></td>
                        </tr>
                        <tr>
                            <td><s:label>PN Amount<strong></strong></s:label></td>
                            <td><s:textfield name="prevamt" id="prevamt" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].loanamount}" /></td>
                        </tr>
                        <tr>
                            <td><s:label>Loan Class<strong></strong></s:label></td>
                            <td><s:textfield name="prevclass" id="prevclass" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].loanapplications.products.productname}" /></td>
                        </tr>
                        <tr>
                            <td><s:label>Loan Type<strong></strong></s:label></td>
                            <s:if test="%{request[prevtype] =='renew'}">
                                <td><s:textfield name="prevtype" id="prevtype" cssStyle="font-size: 11px; width: 100px" readonly="true" value="Renew" /></td>
                            </s:if>
                            <s:else>
                                <td><s:textfield name="prevtype" id="prevtype" cssStyle="font-size: 11px; width: 100px" readonly="true" value="New" /></td>
                            </s:else>
                        </tr>
                        <tr>
                            <td><s:label>Loan Term<strong></strong></s:label></td>
                            <td><s:textfield name="prevterm" id="prevterm" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].term}" /></td>
                        </tr>
                        <tr>
                            <td><s:label>Loan Balance<strong></strong></s:label></td>
                            <td><s:textfield name="prevbal" id="prevbal" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].balance}" /></td>
                        </tr>
                        <tr>
                            <td><s:label>Date of Release<strong></strong></s:label></td>
                            <td><s:textfield name="prevdate" id="prevdate" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].releasedate}" /></td>
                        </tr>
                        <tr>
                            <td><s:label>Loan No.<strong></strong></s:label></td>
                            <td><s:textfield name="prevloanno" id="prevloanno" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].loanno}" /></td>
                        </tr>
                        <tr>
                            <td><s:label>Days Left<strong></strong></s:label></td>
                            <td><s:textfield name="prevleft" id="prevleft" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].releasedate}" /></td>
                        </tr>
                    </table>
                </fieldset>
                <fieldset style="width: 600px; float: left" >
                    <legend><h3>(To be filled up by Branch Secretary after loan is pre-approved)</h3></legend>
                    <%--<jsp:include page="admin/loan.jsp" />--%>
                    <table style="width: 40%" >
                        <tr>
                            <td><s:label>Coborrower Name</s:label></td>
                            <td><s:textfield name="coborrowerfirstname" id="coborrowerfirstname" cssStyle="font-size: 11px; width: 100px" /></td>
                            <td><s:textfield name="coborrowermiddlename" id="coborrowermiddlename" cssStyle="font-size: 11px; width: 100px" /></td>
                            <td><s:textfield name="coborrowerlastname" id="coborrowerlastname" cssStyle="font-size: 11px; width: 100px" /></td>
                        </tr>
                        <tr>
                            <td><s:label>Coborrower Address</s:label></td>
                                <td>
                                    <div class="inputContainer" cssStyle="float: left"><s:textfield cssStyle="font-size: 11px; width: 100px; float: left" label="Street Address" value="%{#request['borrowerinfo'].streetaddress}"  key="bor.streetaddress" name="coborrowerstreetaddress" id="streetaddress" cssClass="validate[required]" /></div>
                            </td>
                            <td>
                                <div class="inputContainer" cssStyle="float: left"><s:textfield cssStyle="font-size: 11px; width: 100px; float: left" label="Barangay" value="%{#request['borrowerinfo'].barangay}"  key="bor.barangay" name="coborrowerbarangay" id="barangay" cssClass="validate[required]"/></div>
                            </td>
                            <td>
                                <div class="inputContainer" cssStyle="float: left"><s:textfield cssStyle="font-size: 11px; width: 100px; float: left" label="City or Municipality" value="%{#request['borrowerinfo'].cityormunicipality}"  key="bor.cityormunicipality" id="cityormunicipality" name="coborrowercityormunicipality" cssClass="validate[required]"/></div>
                            </td>
                            <td>
                                <div class="inputContainer" cssStyle="float: left"><s:textfield cssStyle="font-size: 11px; width: 100px; float: left" label="Province" value="%{#request['borrowerinfo'].province}"  key="bor.province" id="province" name="coborrowerprovince" cssClass="validate[required]"/></div>
                            </td>
                        </tr>
                        <tr>
                            <td><s:label>Business Type</s:label></td>
                            <td><s:textfield cssStyle="font-size: 11px; width: 100px" label="Business Type" key="bor.province" name="businesstype" cssClass="validate[required]"/></td>
                        </tr>
                        <tr>
                            <td><s:label>Amount of Stocks</s:label></td>
                            <td><s:textfield cssStyle="font-size: 11px; width: 100px" label="Amount of Stocks" name="amountofstocks" cssClass="validate[required]"/></td>
                            <td><s:label>Daily Average Sales</s:label></td>
                            <td><s:textfield cssStyle="font-size: 11px; width: 100px" label="Daily Average Sales" name="dailyavesales" cssClass="validate[required]"/></td>
                        </tr>
                        <tr>
                            <td><s:label>Credit Rating</s:label></td>
                            <td><s:textfield cssStyle="font-size: 11px; width: 100px" label="Creditrating" name="creditrating" cssClass="validate[required]"/></td>
                        </tr>

                        <tr>
                            <td colspan="3">
                                <s:label>Types of Collaterals</s:label><br/>
                                    <div class="inputContainer">
                                    <s:iterator value="%{#t.typeof}">
                                        <s:set name="toname" value="type" var="toname" />
                                        <s:checkbox cssClass="validate[minCheckbox[2]] checkbox" name="collateral" id="%{#toname}" value="false" fieldValue="%{#toname}"/><s:label><s:property value="type"/></s:label><br />
                                    </s:iterator>
                                </div>
                                <%--<s:checkbox label="Appliance" name="collateral" value="false" fieldValue="Appliance"/><s:label>Appliance</s:label><br />
                                <s:checkbox label="Motor Vehicle" name="collateral" value="false" fieldValue="Motor Vehicle"/><s:label>Motor Vehicle</s:label><br />
                                <s:checkbox label="Passenger Tricycle" name="collateral" value="false" fieldValue="Passenger Tricycle"/><s:label>Passenger Tricycle</s:label><br />
                                <s:checkbox label="House and Lot" name="collateral" value="false" fieldValue="House and Lot"/><s:label>House and Lot</s:label><br />
                                <s:checkbox label="Land Title" name="collateral" value="false" fieldValue="Land Title"/><s:label>Land Title</s:label><br />
                                <s:label>Others:</s:label><s:textfield id="othertypecollateral" name="collateral" label="Others:" />--%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <s:label>Amount Requested<strong></strong></s:label>
                                </td>
                                <td>
                                    <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 100px" id="amountrequested" name="amountrequested" key="loanapplications.amountrequested" cssClass="validate[required] text-input"/><%-- --%>
                            </td>
                            <td style="display: none"><s:textfield readonly="true" name="status" value="" id="lastatus"/></td>
                        </tr>
                    </table>
                </fieldset>
            </s:div>
            <% System.out.println("loanapplicationcontent.jsp");%>
        </s:form>
    </s:div>
</s:div>
<s:div id="buttons" cssStyle="float:right">
    <%--<sj:a 
        button="true"
        href="#" 
        onclick="evalLoanApp()"
        cssClass="default" 
        cssStyle="float:left;
        height:22px !important;
        margin-top:2px;
        font-size:12px !important;
        line-height: 0;
        font-family: Tahoma, Geneva, sans-serif;">
        Create New
    </sj:a>--%>
    <%--<sj:a 
        button="true"
        href="#" 
        onclick="evalLoanApp()"
        cssClass="default" 
        cssStyle="float:left;
        height:22px !important;
        margin-top:2px;
        font-size:12px !important;
        line-height: 0;
        font-family: Tahoma, Geneva, sans-serif;">
        Save
    </sj:a>--%>
    <%--<sj:submit cssClass="ui-state-default" value="Post Loan Application" button="true" cssStyle="float:left;margin-top:2px;font-size:12px !important;font-family: Tahoma, Geneva, sans-serif !important;" />--%>
    <sj:a
        name="viewCreatedReqs"
        id="viewCreatedReqs"
        onclick="viewCreated()"
        button="true"
        cssStyle="float:left;margin-top:2px;font-size:12px !important;font-family: Tahoma, Geneva, sans-serif !important;"
        >
        View Created Requests
    </sj:a>
    <sj:a
        name="saveLA"
        id="saveLA"
        onclick="saveLoanApp()"
        button="true"
        cssStyle="float:left;margin-top:2px;font-size:12px !important;font-family: Tahoma, Geneva, sans-serif !important;"
        >
        Save to Loan Applications
    </sj:a>
    <%--<s:if test="%{#privilege1e.allowable == true}">--%>
    <sj:a
        name="postLA"
        id="postLA"
        onclick="postLoanApp()"
        button="true"
        cssStyle="float:left;margin-top:2px;font-size:12px !important;font-family: Tahoma, Geneva, sans-serif !important;"
        >
        Post to Loan Request
    </sj:a>
    <%--</s:if>--%>
</s:div>
